<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:th="http://www.thymeleaf.org"
      xmlns:tiles="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org"
      lang="en">

<head>

    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!-- This <head> section is only used for static prototyping purposes. At runtime, -->
    <!-- Tiles will only use the body fragment defined with tiles:fragment="content",  --> 
    <!-- as specified at the corresponding views.xml file.                             -->
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <title>Spring Travel: Spring MVC and Web Flow Reference Application</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    
    <link rel="stylesheet" type="text/css" media="screen, projection" 
          href="../../styles/blueprint/screen.css" />
    
    <link rel="stylesheet" type="text/css" media="print" 
          href="../../styles/blueprint/print.css" />
    
    <!--[if lt IE 8]>
        <link rel="stylesheet" type="text/css" media="screen, projection"
              href="../../styles/blueprint/ie.css" />
    <![endif]-->
    
    <link rel="stylesheet" type="text/css" media="screen" 
          href="../../styles/booking.css" />

    
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  -->
    <!-- Some styles and scripts are served from spring-js-resources-{ver}.jar at -->
    <!-- runtime. Therefore not available for static prototyping. See the         -->
    <!-- layouts/standard.html template file for detail.                          -->
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  -->
    
</head>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- START of the content to be included in the execution result.  -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Only the markup inside this <body> would be required in this  -->
<!-- template if no static prototyping was intended.               -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<body tiles:fragment="content">


<div id="bookings" sec:authorize="hasRole('ROLE_USER')">

    <h2>Current Hotel Bookings</h2>

    <p th:unless="${bookingList}">
        No bookings found
    </p>

    <table class="summary" th:if="${bookingList}">
        <thead>
            <tr>
                <th>Name</th>
                <th>Address</th>
                <th>City, State</th>
                <th>Check in Date</th>
                <th>Check out Date</th>
                <th>Confirmation Number</th>
                <th>Action</th>
            </tr>
        </thead>
        <tbody>
            <tr th:each="booking : ${bookingList}" th:object="${booking}">
                <td th:text="*{hotel.name}">The Herb Plaza</td>
                <td th:text="*{hotel.address}">Thyme Square, 13</td>
                <td th:text="*{hotel.city} + ', ' + *{hotel.state}">Icetown, North Pole</td>
                <td th:text="*{checkinDate}">2012-12-21</td>
                <td th:text="*{checkoutDate}">2012-12-21</td>
                <td th:text="*{id}">1</td>
                <td>
                    <form action="#" th:action="@{'/bookings/' + *{id}}" th:method="'delete'">
                        <button type="submit">Cancel</button>
                    </form>
                </td>
            </tr>
        </tbody>
    </table>
    
</div>


</body>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- END of the content to be included in the execution result -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

</html>
